const UsersModel = require('../database/UserModel')
    //渲染
const list = (req, res) => {
        let list = UsersModel.list()
        UsersModel.list().then((data) => {
            res.json({
                code: 200,
                data,
            })
        })
    }
    // 添加
const add = (req, res) => {
        UsersModel.add(req, res).then(() => {
            res.json({
                code: 200,
                mas: '添加成功'
            })
        })
    }
    //删除
const del = (req, res) => {
    UsersModel.del(req, res).then(() => {
        res.json({
            code: 200,
            mas: '删除成功'
        })
    })
}

//修改
const mod = (req, res) => {
    UsersModel.del(req, res).then(() => {
        res.json({
            code: 200,
            mas: '修改成功'
        })
    })
}

module.exports = {
    list,
    add,
    del,
    mod
}